package com.zj.mes.common.controller;

import com.zj.mes.common.entity.ResultModel;
import com.zj.mes.common.service.IOperationLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * 日志前端控制器
 *
 * @author 王晓楠
 * @date 2019/7/22
 */
@Controller
@RequestMapping("/operationlog")
public class OperationLogController {

    @Autowired
    private IOperationLogService operationLogService;

    /**
     * 前往操做日志页
     *
     * @return 返回日志页
     */
    @RequestMapping("/toOperationLog")
    public String toOperationLog() {
        return "/system/operationlog";
    }

    /**
     * 获得部分日志信息
     *
     * @param query 查询条件
     * @return 查询结果
     */
    @RequestMapping("/getOperationLogLimit")
    @ResponseBody
    public ResultModel getOperationLogLimit(@RequestParam Map<String, Object> query) {
        return operationLogService.getOperationLogLimit(query);
    }

    /**
     * 获得所有的日志信息
     *
     * @param query 查询条件
     * @return 查询结果
     */
    @RequestMapping("/getOperationLogAll")
    @ResponseBody
    public ResultModel getOperationLogAll(@RequestParam Map<String, Object> query) {
        return operationLogService.getOperationLogAll(query);
    }

}
